﻿/*------------------------------------------------------------
 * Author : Tharinduni Udugamasuriya
 * FinCon dll for Handeling DB 
 * Query : Query Management
 -----------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DSPL.Contracts;
using DSPL.Contracts.Interfaces;

namespace DSPL.DataAccess
{
    public class Query : IQuery
    {
        public Query()
        {
            QType = QueryType.NONE;
            NumberOfRecords = 0;
        }

        public string TableName { get; set; }

        public string[] TableNameList { get; set; }

        public string QueryString { get; set; }

        public IColumnWithValue[] ColValues { get; set; }

        public IColumnWithValue[] JoinStructure { get; set; }

        public IColumnWithValue[] WhereClause { get; set; }

        public IColumnWithValue[] HavingClause { get; set; }

        public IColumnWithValue[] OrderbyClause { get; set; }

        public IColumnWithValue[] Groupby { get; set; }

        public IParameter[] ParameterList { get; set; }

        public QueryType QType { get; set; }

        public int NumberOfRecords { get; set; }

        //public Query(string query, QueryType queryType)
        //{
        //    QueryString = query;
        //    QType = queryType;
        //}


        //public Query(string tableName, QueryType queryType, int numCol = 0)
        //{
        //    TableName = tableName;
        //    QType = queryType;
        //    NumCol = numCol;
        //}

        //public Query(string tableName, QueryType queryType, ColumnWithValue[] Where, int numCol = 0)
        //{
        //    TableName = tableName;
        //    QType = queryType;
        //    WhereClause = Where;
        //    NumCol = numCol;
        //}

        //public Query(string tableName, QueryType queryType, ColumnWithValue[] orderby, ColumnWithValue[] Where = null, int numCol = 0)
        //{
        //    TableName = tableName;
        //    QType = queryType;
        //    Orderby = orderby;
        //    WhereClause = Where;
        //    NumCol = numCol;
        //}

        //public Query(string tableName, ColumnWithValue[] parmSet, QueryType queryType, int numCol = 0)
        //{
        //    TableName = tableName;
        //    ColValues = parmSet;
        //    QType = queryType;
        //    NumCol = numCol;
        //}

        //public Query(string tableName, ColumnWithValue[] parmSet, QueryType queryType, ColumnWithValue[] Where, int numCol = 0)
        //{
        //    TableName = tableName;
        //    ColValues = parmSet;
        //    QType = queryType;
        //    WhereClause = Where;
        //    NumCol = numCol;
        //}

        //public Query(string tableName, ColumnWithValue[] parmSet, QueryType queryType, ColumnWithValue[] orderby, ColumnWithValue[] Where = null, int numCol = 0)
        //{
        //    TableName = tableName;
        //    ColValues = parmSet;
        //    QType = queryType;
        //    WhereClause = Where;
        //    Orderby = orderby;
        //    NumCol = numCol;
        //}
    }
}
